'use client';

// Top level component for simple client side only rendering
import React from 'react';
import { renderToString } from 'react-dom/server';
import EchoProps from '../components/EchoProps';

/*
 *  Export an async function that takes the props and returns a promise that resolves to the rendered HTML string.
 *
 *  Note, this is a fictional example, as you'd only use a Render-Function if you wanted to run
 *  some extra code, such as setting up Redux and React Router.
 *
 *  And the use of renderToString would probably be done with React Router v4
 *
 */
export default async (props, _railsContext) => {
  const renderedHtml = await Promise.resolve(renderToString(<EchoProps {...props} />));
  return renderedHtml;
};
